<form id="frmLogin" name="frmLogin" method="POST" action="">
    <table class="detail_info" align="center">
        <tbody>
            <tr>
                <td>&nbsp;</td>
                <td class="column_right">
                    <span style="color: #851A1A; font-size: 2.3em;">Đăng Nhập</span>
                </td>
            </tr>
            <tr>
                <td>&nbsp;</td>
                <td class="column_right">
                <?php if ( $this->error ) {?>
                    <span id="error" style="color: red;">Thông tin đăng nhập không hợp lệ</span>
                <?php } else {?>
                    <span id="error" style="display: none; color: red;"></span>
                <?php }//end if?>
                </td>
            </tr>
            <tr>
                <td class="column_left">Email <span style="color: red;">*</span></td>
                <td class="column_right">
                    <input type="text" name="txtEmail" id="txtEmail" size="45" />
                </td>
            </tr>
            <tr>
                <td class="column_left">Mật khẩu <span style="color: red;">*</span></td>
                <td class="column_right">
                    <input type="password" name="txtPass" id="txtPass" size="45" />
                </td>
            </tr>
        </tbody>
    </table>
    <div class="btn_back">
        <input type="submit" name="submit" value="Đăng nhập" />
    </div>
</form>

<script type="text/javascript">
function checkEmail(email)
{
    var re = /^([A-Za-z0-9\_\-]+\.)*[A-Za-z0-9\_\-]+@[A-Za-z0-9\_\-]+(\.[A-Za-z0-9\_\-]+)+$/;
    if ( email.search(re) == -1 ) {
        return false;
    } else {
        return true;
    }
}

$(function(){
    $("#frmLogin").submit(function(){
        var $error      = $("#error");
        var $email      = $("#txtEmail");
        var email       = $.trim($email.val());
        $email.val(email);
        var $password   = $("#txtPass");
        var password    = $password.val();
        if ( email.length<=0 || password.length<=0 ) {
            $error.html('Vui lòng nhập đầy đủ email và mật khẩu.').show();
            $email.focus();
            return false;
        }
        if ( !checkEmail(email) ) {
            $error.html('Email không hợp lệ.').show();
            $email.focus();
            return false;
        }
        return true;
    });
});
</script>